package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Basedao {
    public Connection getconnection(){
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            String url="jdbc:mysql://localhost:3306/myschool?serverTimezone=UTC&enconding=UTF-8&usessl=flase";
            String name="root";
            String password="123456";
            Connection connection = DriverManager.getConnection(url, name, password);
            return connection;


        } catch (ClassNotFoundException | SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    public static void main(String[] args){
        System.out.println(new Basedao().getconnection());
    }
}
